/*********************************************************
          File Name:10.16.cpp
          Author: Abby Cin
          Mail: abbytsing@gmail.com
          Created Time: Fri 26 Feb 2016 07:56:30 PM CST
**********************************************************/

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

void biggies(vector<string> &words, vector<string>::size_type sz)
{
    sort(words.begin(), words.end());
    words.erase(unique(words.begin(), words.end()), words.end());
    stable_sort(words.begin(), words.end());
    auto wc = find_if(words.cbegin(), words.cend(), 
            [sz](const string &s) {
                return s.size() >= sz;
            });
    cout << words.end() - wc << " word(s) of length " << sz << " or longer\n";
    for_each(words.begin(), words.end(), 
            [](const string &s) {
                cout << s << " ";
            });
    cout << endl;
}

int main()
{
    vector<string> vs{"#000", "this", "#000", "is", "long", "long"};
    biggies(vs, 4);
    return 0;
}
